﻿@using Scorpicore.MVC.Models
@model Scorpicore.MVC.Models.CheckBanknoteViewModel

@{
    ViewBag.Title = "Следите на банкнотата...";
    int count = Model.Points.Count;
}

<h2 class="legend-title">@ViewBag.Title</h2>
<div>
    <table class="table table-bordered table-condensed">
        <thead>
            <tr>
                <td>Дата</td>
                <td>Място</td>
                <td>Бележка</td>
                <td>Време на пътуване(дни)</td>
                <td>Разстояние(км)</td>
                <td>Скорост(км/ден)</td>
            </tr>
        </thead>
        <tbody>
            @for (int i = (count - 1); i > 0; i--)
            {
                <tr>
                    <td>@Model.Points[i].EntryTime.ToShortDateString()</td>
                    <td>@Model.Points[i].Location</td>
                    <td>@Model.Points[i].Message</td>
                    <td>@string.Format("{0:0.0}", Model.Points[i].TravelTime.TotalDays)</td>
                    <td>@string.Format("{0:0.00}", Model.Points[i].Distance)</td>
                    <td>@string.Format("{0:0.00}", Model.Points[i].Distance / Model.Points[i].TravelTime.TotalDays)</td>
                </tr>
            }
            <tr>
                <td>@Model.Points[0].EntryTime.ToShortDateString()</td>
                <td>@Model.Points[0].Location</td>
                <td>@Model.Points[0].Message</td>
                <td>Стартово място</td>
                <td>Стартово място</td>
                <td>Стартово място</td>
            </tr>

        </tbody>
    </table>
    <div id="map-canvas"></div>

    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
    <script>
        var points = @Html.Raw(Model.PointsAsJson)
        google.maps.event.addDomListener(window, 'load', googleMaps.initialize(points));

    </script>
</div>
